<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateGuanyuanSyncShopBusinessTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('guanyuan_sync_shop_business', function (Blueprint $table) {
            $table->id();
            $table->string('placementType', 24)->default('')->comment('投放类型');
            $table->string('placementStartDate', 12)->default('')->comment('投放开始时间');
            $table->string('businessType', 12)->default('')->comment('门店类型');
            $table->string('name', 36)->default('')->comment('门店名称');
            $table->unsignedInteger('code')->default(0)->comment('门店编码');
            $table->string('region', 36)->default('')->comment('区域');
            $table->string('date', 12)->default('')->comment('日期');
            $table->string('orderNum', 12)->default('')->comment('订单量');
            $table->unsignedTinyInteger('isMonthNew')->default(0)->comment('是否本月新开');
            $table->decimal('dailyArtificial', 12, 6)->default(0)->comment('日人工');
            $table->decimal('dailyEnergy', 12, 6)->default(0)->comment('日能源');
            $table->decimal('roi', 12, 6)->default(0)->comment('roi');
            $table->decimal('estimatedProfit', 12, 6)->default(0)->comment('预估利润');
            $table->decimal('openingDurationMonth')->default(0)->comment('开业时长（月）');
            $table->decimal('openingDurationDay')->default(0)->comment('开业时长（天）');
            $table->decimal('area')->default(0)->comment('门店面积');
            $table->decimal('orderTurnover')->default(0)->comment('订单营业额');
            $table->decimal('orderDiscountAmount')->default(0)->comment('订单优惠金额');
            $table->decimal('orderReceivedAmount')->default(0)->comment('订单实收金额');
            $table->unsignedInteger('employeesNum')->default(0)->comment('员工人数');
            $table->string('province', 24)->default('')->comment('省份');
            $table->string('city', 24)->default('')->comment('城市');
            $table->decimal('takeawayTurnover')->default(0)->comment('外卖订单营业额');
            $table->decimal('takeawayDiscountAmount')->default(0)->comment('外卖订单优惠金额');
            $table->decimal('takeawayReceivedAmount')->default(0)->comment('外卖订单实收金额');
            $table->decimal('dineInTurnover')->default(0)->comment('堂食订单营业额');
            $table->decimal('dineInDiscountAmount')->default(0)->comment('堂食订单优惠金额');
            $table->decimal('dineInReceivedAmount')->default(0)->comment('堂食订单实收金额');
            $table->decimal('dineInEstimatedProfit')->default(0)->comment('堂食预估利润');
            $table->decimal('takeawayEstimatedProfit')->default(0)->comment('外卖预估利润');
            $table->decimal('takeawayOrderNum')->default(0)->comment('外卖订单量');
            $table->decimal('dineInOrderNum')->default(0)->comment('堂食订单量');
            $table->string('openBusinessDate', 12)->default('')->comment('开业日期');
            $table->string('closeDate', 12)->default('')->comment('闭店时间');
            $table->string('franchiseeName', 12)->default('')->comment('加盟商');
            $table->decimal('dailyRent')->default(0)->comment('日房租');
            $table->decimal('rent')->default(0)->comment('房租');
            $table->string('district', 24)->default('')->comment('区县');
            $table->string('storeActiveStatus', 12)->default('')->comment('门店活跃状态');
            $table->string('status', 12)->default('')->comment('状态');
            $table->decimal('artificial')->default(0)->comment('人工');
            $table->decimal('breakEvenPoint', 12, 6)->default(0)->comment('保本点');
            $table->unsignedInteger('monthlyBusinessDays')->default(0)->comment('月营业天数');
            $table->decimal('dailyReceivedAmount', 12, 6)->default(0)->comment('日均实收');
            $table->unsignedInteger('monthlyDays')->default(0)->comment('实际月天数');
            $table->unsignedTinyInteger('isCloseShop')->default(0)->comment('是否本年闭店');
            $table->string('address', 120)->default('')->comment('店铺地址');
            $table->string('cityGrade', 120)->default('')->comment('城市等级');
            $table->unsignedInteger('reArea')->default(0)->comment('面积');
            $table->string('roiType', 12)->default('')->comment('ROI分类');
            $table->decimal('vipCardTurnover')->default(0)->comment('会员卡订单营业额');
            $table->decimal('vipCardDiscountAmount')->default(0)->comment('会员卡订单优惠金额');
            $table->decimal('vipCardReceivedAmount')->default(0)->comment('会员卡订单实收金额');
            $table->unsignedInteger('vipCardOrderNum')->default(0)->comment('会员卡订单量');
            $table->string('franchiseeRealName', 12)->default('')->comment('加盟商真名');
            $table->decimal('dailyRentCost', 12, 6)->default(0)->comment('日房租成本');
            $table->decimal('elmTurnover')->default(0)->comment('饿了么订单营业额');
            $table->decimal('elmDiscountAmount')->default(0)->comment('饿了么订单优惠金额');
            $table->decimal('elmReceivedAmount')->default(0)->comment('饿了么订单实收金额');
            $table->unsignedInteger('elmOrderNum')->default(0)->comment('饿了么订单量');
            $table->decimal('mtTurnover')->default(0)->comment('美团订单营业额');
            $table->decimal('mtDiscountAmount')->default(0)->comment('美团订单优惠金额');
            $table->decimal('mtReceivedAmount')->default(0)->comment('美团订单实收金额');
            $table->unsignedInteger('mtOrderNum')->default(0)->comment('美团订单量');
            $table->string('operationManager', 24)->default('')->comment('运营负责人');
            $table->string('privateDomain', 24)->default('')->comment('私域');
            $table->string('operationalStatus', 12)->default('')->comment('代运营状态');
            $table->decimal('averageDailyProfit', 12, 6)->default(0)->comment('日均利润');
            $table->unsignedInteger('receiptGrading')->default(0)->comment('实收分级');
            $table->unsignedInteger('ProfitClassification')->default(0)->comment('利润分级');
            $table->unsignedInteger('weightRoi')->default(0)->comment('加权ROI');
            $table->string('whetherLoss', 4)->default('')->comment('是否亏损');
            $table->string('shopGrade', 12)->default('')->comment('门店分级');
            $table->string('siteLocationType', 12)->default('')->comment('选址分类');
            $table->decimal('elmRating', 4)->default(0)->comment('饿了么评分');
            $table->decimal('mtRating', 4)->default(0)->comment('美团评分');
            $table->string('mtStoreId', 12)->default('')->comment('美团门店ID_改');
            $table->string('elmStoreId', 12)->default('')->comment('饿了么门店ID_改');
            $table->string('cashierSystem', 12)->default('')->comment('收银系统');
            $table->unsignedInteger('elmStar1')->default(0)->comment('1星评价数-e');
            $table->unsignedInteger('elmStar2')->default(0)->comment('2星评价数-e');
            $table->unsignedInteger('elmStar3')->default(0)->comment('3星评价数-e');
            $table->unsignedInteger('elmStar4')->default(0)->comment('4星评价数-e');
            $table->unsignedInteger('elmStar5')->default(0)->comment('5星评价数-e');
            $table->unsignedInteger('mtStar1')->default(0)->comment('1星评价数-m');
            $table->unsignedInteger('mtStar2')->default(0)->comment('2星评价数-m');
            $table->unsignedInteger('mtStar3')->default(0)->comment('3星评价数-m');
            $table->unsignedInteger('mtStar4')->default(0)->comment('4星评价数-m');
            $table->unsignedInteger('mtStar5')->default(0)->comment('5星评价数-m');
            $table->string('elmWaimaiShopId', 12)->default('')->comment('waimaiShopId-饿');
            $table->string('elmWaimaiShopName', 24)->default('')->comment('waimaiShopName-饿');
            $table->string('mtWaimaiShopId', 12)->default('')->comment('waimaiShopId-美');
            $table->string('mtWaimaiShopName', 24)->default('')->comment('waimaiShopName-美');
            $table->string('takeawayStartTime', 12)->default('')->comment('外卖介入时间');
            $table->string('takeawayOldOrNew', 12)->default('')->comment('外卖新店判断');
            $table->string('performanceRanges', 12)->default('')->comment('业绩区间');
            $table->string('activityType', 24)->default('')->comment('活动类型');
            $table->string('storeType', 12)->default('')->comment('铺位类型');
            $table->unsignedInteger('takeawayBusinessDays')->default(0)->comment('外卖营业天数');
            $table->string('temperatureMax', 6)->default('')->comment('temperatureMax');
            $table->string('temperatureMin', 6)->default('')->comment('temperatureMin');
            $table->string('recentAttention', 6)->default('')->comment('近期关注');
            $table->string('nightWeather', 6)->default('')->comment('晚上天气');
            $table->string('noonWeather', 6)->default('')->comment('中午天气');
            $table->string('developmentManager', 24)->default('')->comment('开发经理');
            $table->string('operationSupervision', 24)->default('')->comment('运营督导');
            $table->string('keyCity', 12)->default('')->comment('重点城市');
            $table->string('relocationMark', 12)->default('')->comment('迁址标记');
            $table->decimal('elmRepurchaseRate', 6, 4)->default(0)->comment('饿了么复购率');
            $table->decimal('elmBusinessCirclePeerMean', 6, 4)->default(0)->comment('饿了么商圈同行均值');
            $table->decimal('elmBusinessCirclePeerMeanTop10', 6, 4)->default(0)->comment('饿了么商圈同行TOP10均值');
            $table->decimal('mtRepurchaseRate', 6, 4)->default(0)->comment('美团复购率');
            $table->decimal('mtBusinessCirclePeerMean', 6, 4)->default(0)->comment('美团商圈同行均值');
            $table->decimal('mtBusinessCirclePeerMeanTop10', 6, 4)->default(0)->comment('美团商圈同行TOP10均值');
            $table->string('secondaryLeader', 12)->default('')->comment('二级负责人');
            $table->string('mallGrade', 6)->default('')->comment('商场分级');
            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('updatedAt')->default(0)->comment('修改时间');
            $table->collation = 'utf8mb4_general_ci';

            $table->index(['code', 'date'], 'idx_codeDate');

            $table->comment = '观远门店列表近30天营业状态';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('guanyuan_sync_shop_business');
    }
}
